package org.esk.dablog.service.spi;

import org.esk.dablog.service.UserManager;
import org.esk.dablog.model.Author;
import org.esk.dablog.dao.AuthorDAO;

import java.util.List;

/**
 * This class implements UserManager interface
 * User: jc
 * Date: 01.12.2006
 * Time: 16:29:09
 * $Id:$
 */
public class UserManagerImpl implements UserManager {
    private AuthorDAO authorDAO;


    /**
     *
     * @param username
     * @return
     */
    public Author getAuthorByUsername(String username) {

        return authorDAO.getAuthorByUsername(username);
    }

    /**
     *
     * @param a
     * @return
     */
    public long saveAuthor(Author a) {
        return authorDAO.saveAuthor(a);
    }

    /**
     * 
     * @param usersCount
     * @return
     */
    public List listLastRegisteredUsers(int usersCount) {
        return authorDAO.listLastRegisteredUsers(usersCount);
    }

    /**
     *
     * @param id
     * @return
     */
    public Author getAuthorById(long id) {
        return authorDAO.getAuthorById(id);
    }


    public void setAuthorDAO(AuthorDAO authorDAO) {
        this.authorDAO = authorDAO;
    }
}
